package com.cd.queue.jpa.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;
import java.util.Date;

/**
 * @Description 排队操作日志
 * 正常取前二十个
 * 如写库压力较大 可在缓存中放每位用户20位 超过20位写入前10位
 * 然后前10位 然后继续添加 如此轮询
 * @Author lqq
 * @Date 2024/1/24 14:04
 **/
@Table(name = "db_queue_operation_record",
        indexes = {
        @Index(name = "organiser", columnList = "organiser"),
        @Index(name = "username", columnList = "username")
})
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class QueueOperationRecord {

    @Id
    @GeneratedValue(strategy = javax.persistence.GenerationType.IDENTITY)
    @Column(name = "log_id")
    private Long id;

    //喊号key 可能扩展为 username+activityName
    @Column(name = "organiser")
    private String organiser;

    //喊号人 属于谁的
    @Column(name = "username")
    private String username;

    //操作人 存在a用户给b用户添加了一个操作
    @Column(name = "operator")
    private String operator;

    //操作详情
    @Column(name = "operation")
    private String operation;

    //操作时间 YYYY-MM-DD HH:mm:ss
    @Column(name = "operation_time")
    private Date operationTime;

}
